<?php

namespace app\business\controller;

use app\business\model\BusinessClassify;
use app\business\model\BusinessLogin;
use app\business\model\BusinessMenu;
use app\business\model\BusinessOrder;
use think\Controller;
use app\business\controller\Base;
use think\Session;
use think\Db;

class Printer extends Base
{
    public function index()
    {

        //var_dump($_SESSION);die;
        $data = Db::table('business_printer')->select();

        $this->assign('data',$data);

        return $this->fetch();
    }

    public function create()
    {
        return $this->fetch();
    }

    public function store()
    {
        $data = $_POST;


        $data['printer_shop_id'] = $_SESSION['think']['business_id'];
        Db::table('business_printer')->insert($data);

        return $this->redirect('index');
    }

    public function delete($id)
    {
        Db::table('business_printer')->where('id',$id)->delete();

        return $this->redirect('index');
    }

    public function edit($id)
    {
       $data =  Db::table('business_printer')->where('id',$id)->find();

       $this->assign('data',$data);

       return $this->fetch();
    }

    public function update()
    {
        $data = input('post.');
        //var_dump($data);die;
        Db('printer')->update($data);

        return $this->redirect('index');
    }
}